import java.io.BufferedReader;
import java.io.FileReader;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Random;
import java.util.StringTokenizer;





public class DataReader {
	
	public int nbCircles; 
	public ArrayList<Double> radii=new ArrayList<Double>(); 
	public ArrayList<Double> xcenters=new ArrayList<Double>();
	public ArrayList<Double> ycenters=new ArrayList<Double>();
	public Random generator=new Random(); 
	
	public DataReader() throws Exception{
		

	     // BufferedReader in = new BufferedReader(new FileReader("C:\\Documents and Settings\\Francesco\\Bureau\\couronne.txt"));

	      BufferedReader in = new BufferedReader(new FileReader("/tmp/gazule.txt"));

			
			String ligne = in.readLine();
			nbCircles=Integer.parseInt(ligne); 
			System.out.println("nb cercles : "+nbCircles); 
			int nbrad=0; 
			ligne=in.readLine();
			while (ligne != null) {
				StringTokenizer st=new StringTokenizer(ligne);
			
				while(st.hasMoreTokens()){
					String curr=st.nextToken(); 
					if(curr.equals("END"))break;
					System.out.println(curr);
					if(nbrad<nbCircles)
					this.radii.add(Double.parseDouble(curr));
					else
					{
						if((nbrad-nbCircles)%2==0){
							this.xcenters.add(Double.parseDouble(curr));
							//System.out.println(curr+" dans xcenters"); 
						}
						else{
							this.ycenters.add(Double.parseDouble(curr));
							//System.out.println(curr+" dans ycenters");
						}
					}
					nbrad++;
					//System.out.println(radii.size()+" "+xcenters.size()+" "+ycenters.size()); 
				
				}
				
				//System.out.println(ligne);
				
				ligne = in.readLine();
			}
			in.close();
			//System.out.println(radii.size()+" "+xcenters.size()+" "+ycenters.size()); 
			try {PrintStream output=new PrintStream("C:\\Documents and Settings\\Francesco\\Bureau\\outcouronne.txt");
			for(int i=0;i<nbCircles;i++){
				if(radii.get(i)<1){
				output.println("sphere{<"+xcenters.get(i)+",0,"+ycenters.get(i)+">,"+radii.get(i)+" texture{pigment{color rgb<"+(1+0.5*generator.nextDouble())/2+","+(1+0.5*generator.nextDouble())/2+","+(1+0.5*generator.nextDouble())/2+">}} finish{Fin1}}"); 
				System.out.println("sphere{<"+xcenters.get(i)+",0,"+ycenters.get(i)+">,"+radii.get(i)+" texture{pigment{color rgb<"+(1+0.5*generator.nextDouble())/2+","+(1+0.5*generator.nextDouble())/2+","+(1+0.5*generator.nextDouble())/2+">}} finish{Fin1}}"); 
				
				//output.println("sphere{<"+xcenters.get(i)+",0,"+ycenters.get(i)+">,"+radii.get(i)+" texture{Textt1} finish{Fin1}}");
				//String s="object{echiquier scale "+radii.get(i)+"/rapport rotate "+generator.nextDouble()*360+"*y translate <"+xcenters.get(i)+",0,"+ycenters.get(i)+">}";
				//System.out.println(s); 
				//output.println(s); 
				}
			}
			}
			catch(Exception e){System.out.println(e); }
	}
	public static void main(String[] args) throws Exception{
		DataReader hh=new DataReader(); 
	}

}
